package protein

import project.*
import data.ProteinGroups
import data.Literature

class Protein {
	String mainId
	Integer idVersion
	String description = ''
	String sequence = ''
        Integer weight
        SourceOrganism organism

		
	static hasMany = [altNames : ProteinAltName, 
			chromosomes:ProteinChromosome, 
			referenceIds:ProteinReference,
			sourceReferences:ProteinReference,
                        genes:GeneName, 
                        proteinGroup:ProteinGroups, 
                        literature: Literature ]
	
        static constraints = {
        }
	
	static mapping = {
		sequence(sqlType:"text", lenght:2000)
		description(sqlType:"varchar(500)")
		sourceReferences joinTable: 'ipi_sourcereferences'
		referenceIds joinTable: 'ipi_referenceids'
     		proteinGroup joinTable: 'protein_to_group'
	}

	
	String toString() {
//		return "DBid: $id\n" +
//			"ID: $mainId.$version\n" +
//			"Description: $description\n" +
//			"Sequence: $sequence\n" +
//			"Source: $sourceReferences\n" +
//			"AltNames: $altNames\n" +
//			"Chromosomes: $chromosomes\n" +
//			"RefIds: $referenceIds\n"
                return mainId
	}
}
